//import 'package:fish_redux/fish_redux.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_oa/googlemap/home_page.dart';
import 'package:flutter_oa/mainpage/customerdetail.dart';
import 'package:flutter_oa/mainpage/customeredit.dart';
import 'package:flutter_oa/mainpage/main_page.dart';
import 'package:flutter_oa/mainpage/me.dart';
import 'package:flutter_oa/mainpage/test.dart';
import 'package:flutter_oa/my_image_picker.dart';
import 'package:flutter_oa/page_root.dart';
import 'package:flutter_oa/viewpagers/page_host.dart';

import '../contract.dart';
import '../login.dart';
import '../splash.dart';

class Routes {
  static Router router;
  static String rootPage = '/';
  static String login = '/login';
  static String splash = '/splash';
  static String main = '/main';
  static String contract = '/contract';
  static String customerdetiail = '/customerdetiail';
  static String customeredit = '/customeredit';
  static String me = '/me';
  static String test = '/test';
  static String myimagepicker = '/myimagepicker';
  static String pagehost = '/pagehost';
  static String googlemap = '/googlemap';

//  static String PageHost = '/PageHost';
//  static AbstractRoutes routes;




  static var splashHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return Splash();
  });
  static var loginHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return Login();
  });
  static var mainHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return MainPage();
  });
  static var contractHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return Contract();
  });

  static var customerDetailHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return CustomerDetail();
  });

  static var customerEditHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return CustomerEdit();
  });
  static var meHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return Me();
  });

  static var testandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return MyHomePage();
  });

  static var myImagePickerHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    String type = params["type"]?.first;
    return MyImagePicker(type: type);
  });

  static var pageHostHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
        return PageHost();
      });
  static var googleMapHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
        return GoogleMapPage();
      });
//  static var reduxHandler = Handler(
//      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
//        return routes.buildPage('redux', null);
//      });

  static void configureRoutes(Router router) {
//    routes = HybridRoutes(routes: <AbstractRoutes>[
//      PageRoutes(
//        pages: <String, Page<Object, dynamic>>{
//          'redux': ReduxPage(),
//        },
//      ),
//    ]);

    router.define(rootPage,
        handler: Handler(handlerFunc: (context, params) => PageRoot()));
    router.define(splash, handler: splashHandler);
    router.define(login, handler: loginHandler);
    router.define(main, handler: mainHandler);
    router.define(contract, handler: contractHandler);
    router.define(customerdetiail, handler: customerDetailHandler);
    router.define(customeredit, handler: customerEditHandler);
    router.define(me, handler: meHandler);
    router.define(myimagepicker, handler: myImagePickerHandler);
    router.define(test, handler: testandler);
    router.define(pagehost, handler: pageHostHandler);
    router.define(googlemap, handler: googleMapHandler);
//    router.define(redux, handler: reduxHandler);
    Routes.router = router;
  }
}
